package scala.function

/**
 * 函数定义方式
 */
case object FunctionDeclareTest01 {

  def main(args: Array[String]): Unit = {

    //1.无参，无返回值
    def voidMethod(): Unit = println("无参构造方法")

    voidMethod()

    //2.无参，有返回值
    def stringMethod(): String = "无参，有返回值"

    println(stringMethod())

    //3.有参，无返回值
    def stringInMethod(name: String): Unit = println(name)

    println(stringInMethod("li"))

    //4.有参，有返回值
    def calString(name: String): String = "有参，有返回值：" + name

    println(calString("嘻嘻嘻"))

    //5.多参，无返回值
    def multiParameter(name: String, age: Int): Unit = println("多参，无返回值" + name + age)

    println(multiParameter("li", 19))
  }
}
